.SUFFIXES: .c .o

CC = gcc
LEX = flex -I
YACC = bison

INC_PATH = -I/usr/include/mysql
LIB_PATH = -L/usr/lib/mysql -lm -lmysqlclient
LIBRARY = -lsocket -lnsl -lm -lz

SRCS = my_api.c
OBJS = my_api.o

TARGET = my
SANNER = scanner

$(TARGET): $(OBJS)
	$(CC) -o $(TARGET) $(OBJS) $(LIB_PATH) $(LIBARY)

$(OBJS): $(SRCS)
	$(CC) -c $(SRCS) $(INC_PATH)

lexer: clean lex.yy.c scanner

$(SANNER): lex.yy.c
	$(CC) lex.yy.c -o scanner -ll	

lex.yy.c: scanner.l
	$(LEX) scanner.l

clean:
	rm -rf $(OBJS)
	rm -rf $(TARGET)
	rm -rf lex.yy.c
	rm -rf $(SANNER)

mysql_connect.o: mysql_connect.c
